using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Globalization;
using DevExpress.XtraReports.UI;
using NetROS.Tiers.Entities;

namespace ReportiPla
{
    public partial class RSMStrAOld : DevExpress.XtraReports.UI.XtraReport
    {
        public RSMStrAOld(VwObracunZaID _list)
        {
            InitializeComponent();
            bindingSource1.DataSource = _list;
        }

        public RSMStrAOld()
        {
            InitializeComponent();
            
        }

        private void IDObrasca4_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            XRLabel moj = ((XRLabel)sender);
            int znak = 0;
            znak = Convert.ToInt32((moj.Name.Substring(moj.Name.Length - 2)));
            string tekst;
            decimal dec;
            if (!String.IsNullOrEmpty(moj.Text.ToString()))
            {
                dec = Convert.ToDecimal(moj.Text.ToString());
                tekst = String.Format(CultureInfo.InvariantCulture, "{0:0.00}", Math.Round(dec, 2, MidpointRounding.AwayFromZero));
                tekst = tekst.PadLeft(15, Convert.ToChar("0"));
                moj.Text = tekst.Substring(15 - znak, 1);
            }
            else
            {
                moj.Text = "0";
            }

        }
        private void RSMSHA_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            XRLabel moj = ((XRLabel)sender);
            int znak = 0;
            znak = Convert.ToInt32((moj.Name.Substring(moj.Name.Length - 2)));
            string tekst;
            decimal dec;
            if (!String.IsNullOrEmpty(moj.Text.ToString()))
            {
                tekst = moj.Text;
                tekst += "000";
                moj.Text = tekst.Substring(tekst.Length - znak, 1);
            }
            else
            {
                moj.Text = " ";
            }

        }

        private void mjisplate04_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            if (bindingSource1.Current is VwObracunZaID && ((VwObracunZaID)bindingSource1.Current).IsplaceniPrimici.Value == 0)
            {
                ((XRLabel)sender).Text = "0";
            }
            else
            {
                IDObrasca4_BeforePrint(sender, e);
            }
        }


       

    }
}
